public class Dog {
    public String name;
    public int age;
    public String color;


    public Dog(){
        this("大黄",9,"黄色");
        System.out.println("不带参数的构造方法：");

    }
    public Dog(String name, int age, String color) {
        this.name = name;
        this.age = age;
        this.color = color;
    }


    /*public Dog(String name,int age,String color){
this.name=name;
 this.age=age;
 this.color=color;
    }*/

    public void eat() {System.out.println(this.name + "正在吃狗粮");}
    public void sleep() {System.out.println(this.name + "正在睡觉");}
    public void show() {System.out.println("姓名:" + this.name + " 年龄:" + this.age + " 颜色:" + this.color);}


    public static void main(String[] args) {
      Dog dog=new Dog();  //实际上调用构造方法，此时没有参数说明调用的是不带参数构造方法
      dog.show();
      Dog dog1=new Dog("小飞飞",10,"黑色");
      dog1.show();
    }
}


